package com.cbts.entity;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * UserInfo entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "user_info", catalog = "cbts")
public class UserInfo implements java.io.Serializable {

	// Fields

	private String userid;
	private Department department;
	private UserGroup userGroup;
	private String pwd;
	private String userName;
	private Date registerTime;
	private String email;
	private String emailValidated;
	private String gender;
	private String authority;
	private String position;
	private Double count;
	private Set<BusinessTravel> businessTravels = new HashSet<BusinessTravel>(0);
	private Set<BusinessTravelList> businessTravelListsForUserid = new HashSet<BusinessTravelList>(
			0);
	private Set<BusinessTravelList> businessTravelListsForVerifierId = new HashSet<BusinessTravelList>(
			0);
	private Set<ApplayReim> applayReims = new HashSet<ApplayReim>(0);
	private Set<ExchangeRecord> exchangeRecords = new HashSet<ExchangeRecord>(0);

	// Constructors

	/** default constructor */
	public UserInfo() {
		emailValidated="否";
		gender="男";
		authority="员工";
		count=0.00;
	}

	/** minimal constructor */
	public UserInfo(String userid, String pwd, String userName,
			String emailValidated, String gender, String authority) {
		this.userid = userid;
		this.pwd = pwd;
		this.userName = userName;
		this.emailValidated = emailValidated;
		this.gender = gender;
		this.authority = authority;
	}

	/** full constructor */
	public UserInfo(String userid, Department department, UserGroup userGroup,
			String pwd, String userName, Date registerTime, String email,
			String emailValidated, String gender, String authority,
			String position, Double count, Set<BusinessTravel> businessTravels,
			Set<BusinessTravelList> businessTravelListsForUserid,
			Set<BusinessTravelList> businessTravelListsForVerifierId,
			Set<ApplayReim> applayReims, Set<ExchangeRecord> exchangeRecords) {
		this.userid = userid;
		this.department = department;
		this.userGroup = userGroup;
		this.pwd = pwd;
		this.userName = userName;
		this.registerTime = registerTime;
		this.email = email;
		this.emailValidated = emailValidated;
		this.gender = gender;
		this.authority = authority;
		this.position = position;
		this.count = count;
		this.businessTravels = businessTravels;
		this.businessTravelListsForUserid = businessTravelListsForUserid;
		this.businessTravelListsForVerifierId = businessTravelListsForVerifierId;
		this.applayReims = applayReims;
		this.exchangeRecords = exchangeRecords;
	}

	// Property accessors
	@Id
	@Column(name = "userid", unique = true, nullable = false, length = 15)
	public String getUserid() {
		return this.userid;
	}

	public void setUserid(String userid) {
		this.userid = userid;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "departmentId")
	public Department getDepartment() {
		return this.department;
	}

	public void setDepartment(Department department) {
		this.department = department;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "userGroupId")
	public UserGroup getUserGroup() {
		return this.userGroup;
	}

	public void setUserGroup(UserGroup userGroup) {
		this.userGroup = userGroup;
	}

	@Column(name = "pwd", nullable = false, length = 15)
	public String getPwd() {
		return this.pwd;
	}

	public void setPwd(String pwd) {
		this.pwd = pwd;
	}

	@Column(name = "userName", nullable = false, length = 15)
	public String getUserName() {
		return this.userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "registerTime", length = 10)
	public Date getRegisterTime() {
		return this.registerTime;
	}

	public void setRegisterTime(Date registerTime) {
		this.registerTime = registerTime;
	}

	@Column(name = "email", length = 25)
	public String getEmail() {
		return this.email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	@Column(name = "emailValidated", nullable = false, length = 2)
	public String getEmailValidated() {
		return this.emailValidated;
	}

	public void setEmailValidated(String emailValidated) {
		this.emailValidated = emailValidated;
	}

	@Column(name = "gender", nullable = false, length = 2)
	public String getGender() {
		return this.gender;
	}

	public void setGender(String gender) {
		this.gender = gender;
	}

	@Column(name = "authority", nullable = false, length = 4)
	public String getAuthority() {
		return this.authority;
	}

	public void setAuthority(String authority) {
		this.authority = authority;
	}

	@Column(name = "position", length = 45)
	public String getPosition() {
		return this.position;
	}

	public void setPosition(String position) {
		this.position = position;
	}

	@Column(name = "count", precision = 11)
	public Double getCount() {
		return this.count;
	}

	public void setCount(Double count) {
		this.count = count;
	}

	@OneToMany( fetch = FetchType.LAZY, mappedBy = "userInfo")
	public Set<BusinessTravel> getBusinessTravels() {
		return this.businessTravels;
	}

	public void setBusinessTravels(Set<BusinessTravel> businessTravels) {
		this.businessTravels = businessTravels;
	}

	@OneToMany( fetch = FetchType.LAZY, mappedBy = "userInfoByUserid")
	public Set<BusinessTravelList> getBusinessTravelListsForUserid() {
		return this.businessTravelListsForUserid;
	}

	public void setBusinessTravelListsForUserid(
			Set<BusinessTravelList> businessTravelListsForUserid) {
		this.businessTravelListsForUserid = businessTravelListsForUserid;
	}

	@OneToMany( fetch = FetchType.LAZY, mappedBy = "userInfoByVerifierId")
	public Set<BusinessTravelList> getBusinessTravelListsForVerifierId() {
		return this.businessTravelListsForVerifierId;
	}

	public void setBusinessTravelListsForVerifierId(
			Set<BusinessTravelList> businessTravelListsForVerifierId) {
		this.businessTravelListsForVerifierId = businessTravelListsForVerifierId;
	}

	@OneToMany( fetch = FetchType.LAZY, mappedBy = "userInfo")
	public Set<ApplayReim> getApplayReims() {
		return this.applayReims;
	}

	public void setApplayReims(Set<ApplayReim> applayReims) {
		this.applayReims = applayReims;
	}

	@OneToMany( fetch = FetchType.LAZY, mappedBy = "userInfo")
	public Set<ExchangeRecord> getExchangeRecords() {
		return this.exchangeRecords;
	}

	public void setExchangeRecords(Set<ExchangeRecord> exchangeRecords) {
		this.exchangeRecords = exchangeRecords;
	}

}